package cz.muni.fi.pa165.sme.web.fo;

import java.util.Date;
import java.util.List;

import org.apache.wicket.authroles.authorization.strategies.role.Roles;

/**
 * @author jirankova
 */
public class UserFO {

	private Long id;
	private SexFO sex;
	private String firstName;
	private String lastName;
	private Date dateOfBirth;
	private Float weight;
	private Integer height;
	private List<SportActivityRecordFO> sportActivityRecords;
	private String login;
	private String password;
	private Roles roles;

	public Long getId() {
		return id;
	}

	public void setId(final Long id) {
		this.id = id;
	}

	public SexFO getSex() {
		return sex;
	}

	public void setSex(final SexFO sex) {
		this.sex = sex;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(final String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(final String lastName) {
		this.lastName = lastName;
	}

	public Date getDateOfBirth() {
		return dateOfBirth;
	}

	public void setDateOfBirth(final Date dateOfBirth) {
		this.dateOfBirth = dateOfBirth;
	}

	public Float getWeight() {
		return weight;
	}

	public void setWeight(final Float weight) {
		this.weight = weight;
	}

	public Integer getHeight() {
		return height;
	}

	public void setHeight(final Integer height) {
		this.height = height;
	}

	public List<SportActivityRecordFO> getSportActivityRecords() {
		return sportActivityRecords;
	}

	public void setSportActivityRecords(final List<SportActivityRecordFO> sportActivityRecords) {
		this.sportActivityRecords = sportActivityRecords;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(final String login) {
		this.login = login;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(final String password) {
		this.password = password;
	}

	public Roles getRoles() {
		return roles;
	}

	public void setRoles(final Roles roles) {
		this.roles = roles;
	}

	public boolean hasRole(final String role) {
		if(roles != null){
			return roles.hasRole(role);
		} else {
			return false;
		}
	}

	@Override
	public boolean equals(final Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		final UserFO userFO = (UserFO) o;

		if (id != null ? !id.equals(userFO.id) : userFO.id != null) return false;

		return true;
	}

	@Override
	public int hashCode() {
		return id != null ? id.hashCode() : 0;
	}
}
